using DA.AnimGraph;
using UnityEngine;

namespace DA.AnimGraph.Editor {

    internal struct HandleKeeper<T> where T : AGAHandleBase {
        readonly T handleInternal;
        public T handle { get => handleInternal; }
        private uint version;
        public bool isDirty => handle.version != version;
        public bool isValid => handle.isValid;

        public AUID uuid => handleInternal.uuid;

        public HandleKeeper(T handle) {
            Debug.Assert(handle != null);
            handleInternal = handle;
            version = 0;
        }

        public void ClearDirty() {
            version = handle.version;
        }
    }
}
